<?php

namespace app\controllers;


use app\services\RecruitService;
use core\base\BaseController;
use core\lib\R;

class RecruitController extends BaseController
{
    public function actionIndex()
    {
        return $this->render('index');
    }

    public function actionShowList()
    {
        $page = R::numeric('page');
        // 获取搜索条件
        $search = R::string('search');
        $args = [
            'page' => $page,
            'search' => $search
        ];
        $recruitService = new RecruitService();
        $this->renderJson($recruitService->search($args));
    }

    public function actionEdit()
    {
        $id = R::numeric('id');
        $resumeID = R::numeric('resumeID');
        $name = R::string('name');
        $mobile = R::string('mobile');
        $email = R::string('email');
        $realFileName = R::string('realFileName');
        $args = [
            'resume_id' => $resumeID,
            'name' => $name,
            'mobile' => $mobile,
            'email' => $email,
            'real_file_name' => $realFileName
        ];
        $recruitService = new RecruitService();
        $this->renderJson($recruitService->editOne($id, $args));
    }

    public function actionChangeCheckStatus()
    {
        $id = R::numeric('id');
        $status = R::numeric('status');
        $recruitService = new RecruitService();
        $this->renderJson($recruitService->changeCheckStatus($id, $status));
    }

    public function actionExport()
    {
        $recruitService = new RecruitService();
        $recruitService->export();
    }
}